import classNames from 'classnames'
import './index.css'
import { useState } from 'react'


export default function Classnames() {
    const [a, seta] = useState(0)
    const b = [{ name: "最新", id: 0 }, { name: '热门', id: 1 }, { name: '不热门', id: 2 }, { name: '不最新', id: 3 }]
    return (
        <div>
            {/* 创建空数组填满0进行遍历 */}
            {/* {new Array(3).fill(0).map((item,index)=><div key={index}>{item}</div>)} */}
            {b.map((item, index) => <div onClick={() => { seta(index) }} className={classNames('nav1', { nav2: item.id === a })} key={item.id}>{item.name}</div>)}
        </div>
    )
}
